package sys.interaction;

import sys.person.AbstractPerson;
import sys.person.TeaAndStu;
import sys.ui.TeaAndStuMenu;

import java.util.Scanner;

import static sys.interaction.IteracMain.interMain;

public class IteracTeaAndStu {

    static int select;

    public static void interTeaAndStu() {

        Scanner input = new Scanner(System.in);
        String id;
        String name;

        System.out.print("请分别输入你的学号和姓名：　");
        id = input.next();
        name = input.next();

        TeaAndStu teaAndStu = new TeaAndStu(id, name);

        while (true) {
            TeaAndStuMenu.disPlay();
            select = input.nextInt();
            switch (select) {
                case 1 : {
                    AbstractPerson.browseEvent();
                    break;
                }
                case 2 : {
                    AbstractPerson.browseEvent();
                    System.out.print("输入您要查看的项目编号： ");
                    String eventID = input.next();
                    AbstractPerson.checkScoreOrRankOfEvent(eventID);
                    System.out.println("\n查看完毕！\n");
                    break;
                }
                case 3 : {
                    AbstractPerson.browseEvent();
                    System.out.print("输入您要报名的项目编号： ");
                    String eventID = input.next();
                    teaAndStu.participateEvent(eventID);
                    System.out.println("报名成功！");
                    break;
                }
                case 4 : {
                    AbstractPerson.browseEvent();
                    System.out.print("输入您要报名的项目编号： ");
                    String eventID = input.next();
                    teaAndStu.becomeJudge(eventID);
                    System.out.println("报名成功！");
                    break;
                }
                case 5 : {
                    AbstractPerson.browseEvent();
                    System.out.print("输入您要报名的项目编号： ");
                    String eventID = input.next();
                    teaAndStu.becomeVolunteer(eventID);
                    System.out.println("报名成功！");
                    break;
                }
                case 0 : {
                    interMain();
                    break;
                }
                default: {
                    System.out.print("请重新输入： ");
                }
            }
        }
    }
}
